Php user-defined function code for forced File Download
If you want to download the file directly when you click the corresponding link instead of displaying it on the webpage, you need to set the header information forcibly.Share a piece of php function implementation code that does not generate garbled code to implement forced download of files.For example, php implements the code for forced file download.
/**
* Downloader
*
* @ Param $ archivo
Sometimes we want pieces, text documents, Web pages, MP3, PDFs, and so on, when clicked on the corresponding link to download directly, rather than on the page display, then you need to force the header header information. The following is a piece of PHP function implementation code that does not produce garbled, other programming languages can also be referenced to write the implementation.
Copy CodeThe code is as follows:
/**
* Downloader
*
* @param $archivo
* Path Al Archivo
* @param $downlo
Sometimes we want pieces, text documents, Web pages, MP3, PDFs, and so on, when clicked on the corresponding link to download directly, rather than on the page display, then you need to force the header header information. The following is a piece of PHP function implementation code that does not produce garbled, other programming languages can also be referenced to write the implementation.
Copy CodeThe code is as follows:
/**
* Downloader
*
* @param $archivo
* Path Al Archivo
* @param $downlo
Sometimes when you want to download the link directly instead of on the page, you need to force header information to be set.Share a piece of PHP function implementation code that does not produce garbled characters, implement the mandatory download of the file.example, the PHP implementation file forces the download of the code.
/**
* Downloader
*
* @param $archivo
* Path Al Archivo
* @param $downloadfilename
* (null|string) el nombre que q
PHP force File Download
PHP force File Download
/** * Downloader * * @param $archivo * path al archivo * @param $downloadfilename * (null|string) el nombre que queres usar para el archivo que se va a descargar. * (si no lo especificas usa el nombre actual del archivo) * * @return file stream */function download_file($archivo, $downloadfilename = null) { if (file_exists($archivo)) { $downloadfilename = $downloadfilename !== null ? $downl
Sometimes we want content like pictures, text documents, Web pages, MP3, PDFs to be downloaded directly when you click on the link, instead of on the Web page, then you need to force header header information. The following is a paragraph will not generate garbled PHP function implementation code, other program language can also refer to the written implementation.
Copy Code code as follows:
/**
* Downloader
*
* @param $archivo
* Path Al Archivo
* @param $downloadfilename
* (nul
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.